<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../css/css.css" /><!-- CSS -->
        <?php include '../language/detectLanguage.php'; ?><!-- Fichier langues -->

        <title>Résumé</title>

        <style>
            input[readonly]{
                border: none;
                background: none;
                color: black;
            }
        </style>
    </head>

    <body>
        <h1>Summary</h1>

        <div>
            <p class="explications">Veuillez vérifier les valeurs ci-dessous.<br/>
                Si les valeurs sont correctes merci de valider afin de générer le rapport énergétique.</p>
        </div>

        <?php
        /*
         * Données "GeneralitiesLocality"
         * Récupération et découpage de l'adresse
         */
        $address = $_POST['address'];
        $locality = explode(",", $address);

        $adresse = null;
        $ville = null;

        if (count($locality) == 3) {
            $adresse = $locality[0];
            $ville = $locality[1];
        }
        if (count($locality) == 2) {
            $ville = $locality[0];
        }
        
        /*
         * Test si des valeurs sont rentrées
         * Si la valeur commence par 'Ex.', on n'affiche rien
         */
        $yearHouse = $_POST['year'];
        if(substr($yearHouse, 0, 3) == 'Ex.'){
            $yearHouse = '-';
        }
        $floors = $_POST['floorsOccupied'];
        if(substr($yearHouse, 0, 3) == 'Ex.'){
            $yearHouse = '1';
        }
        $ridgeHeight = $_POST['inputRidge'];
        if(substr($ridgeHeight, 0, 3) == 'Ex.'){
            $ridgeHeight = '- ';
        }
        $h = $_POST['inputH'];
        if(substr($h, 0, 3) == 'Ex.'){
            $h = '- ';
        }
        $m1 = $_POST['inputM1'];
        if(substr($m1, 0, 3) == 'Ex.'){
            $m1 = '- ';
        }
        $m2 = $_POST['inputM2'];
        if(substr($m2, 0, 3) == 'Ex.'){
            $m2 = '- ';
        }
        $m3 = $_POST['inputM3'];
        if(substr($m3, 0, 3) == 'Ex.'){
            $m3 = '- ';
        }
        $m4 = $_POST['inputM4'];
        if(substr($m4, 0, 3) == 'Ex.'){
            $m4 = '- ';
        }
        $m5 = $_POST['inputM5'];
        if(substr($m5, 0, 3) == 'Ex.'){
            $m5 = '- ';
        }
        $m6 = $_POST['inputM6'];
        if(substr($m6, 0, 3) == 'Ex.'){
            $m6 = '- ';
        }
        $m7 = $_POST['inputM7'];
        if(substr($m7, 0, 3) == 'Ex.'){
            $m7 = '- ';
        }
        ?>

        <form id="summaryForm" method="POST" action="report/generateReport.php">
            <table id="summaryTab">
                <tr>
                    <th colspan="2">Valeurs des pages "<?php echo TXT_TAB_GENERALITIES; ?>"</th>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_GENERALITIES; ?> - <?php echo TXT_SUBMENU_LOCALITY; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_LANDSCAPE; ?></td>
                    <td><?php $landscape = $_POST['landscape']; ?>
                        <input hidden type="text" name="landscape" value="<?php echo $landscape; ?>" /><?php
                        if ($landscape == 1) {
                            echo TXT_CITY;
                        }
                        if ($landscape == 2) {
                            echo TXT_COUNTRYSIDE;
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td>Adresse</td>
                    <td><input readonly type="text" name="adresse" value="<?php echo $adresse; ?>" /></td>
                </tr>
                <tr>
                    <td>Ville</td>
                    <td><input readonly type="text" name="ville" value="<?php echo $ville; ?>" /></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_GENERALITIES; ?> - <?php echo TXT_SUBMENU_SHAPES; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_HOUSE_SHAPE; ?></td>
                    <td><?php $shape = $_POST['shape']; ?>
                        <input hidden type="text" name="shape" value="<?php echo $shape; ?>" /><?php
                        if ($shape == 1) {
                            echo TXT_SQUARE;
                        }
                        if ($shape == 2) {
                            echo TXT_RECTANGLE;
                        }
                        if ($shape == 3) {
                            echo 'L';
                        }
                        if ($shape == 4) {
                            echo 'U';
                        }
                        if ($shape == 5) {
                            echo 'Z';
                        }
                        if ($shape == 6) {
                            echo 'T';
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_ROOF_SHAPE; ?></td>
                    <td><input readonly type="text" name="roofShape" value="<?php echo $_POST['roofShape']; ?>" /></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_GENERALITIES; ?> - <?php echo TXT_SUBMENU_HOUSE; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_BUILT_YEAR; ?></td>
                    <td><input readonly type="text" name="yearHouse" value="<?php echo $yearHouse; ?>" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_NUMBER_OF_FLOORS; ?></td>
                    <td><input readonly type="text" name="floorsOccupied" value="<?php echo $floors; ?>" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_BALCONY; ?></td>
                    <td><?php $balcony = $_POST['balcony']; ?>        
                        <input hidden type="text" name="balcony" value="<?php echo $balcony; ?>" /><?php
                        if ($balcony == 'true') {
                            echo TXT_YES;
                        }
                        if ($balcony == 'false') {
                            echo TXT_NO;
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_EAVE; ?></td>
                    <td><?php $eaves = $_POST['eaves']; ?>
                        <input hidden type="text" name="eaves" value="<?php echo $eaves; ?>" /><?php
                        if ($eaves == 'true') {
                            echo TXT_YES;
                        }
                        if ($eaves == 'false') {
                            echo TXT_NO;
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_GENERALITIES; ?> - <?php echo TXT_SUBMENU_DIMENSIONS; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_RIDGE; ?></td>
                    <td><input readonly type="text" name="inputRidge" value="<?php echo $ridgeHeight; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> H</td>
                    <td><input readonly type="text" name="inputH" value="<?php echo $h; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M1</td>
                    <td><input readonly type="text" name="inputM1" value="<?php echo $m1; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M2</td>
                    <td><input readonly type="text" name="inputM2" value="<?php echo $m2; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M3</td>
                    <td><input readonly type="text" name="inputM3" value="<?php echo $m3; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M4</td>
                    <td><input readonly type="text" name="inputM4" value="<?php echo $m4; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M5</td>
                    <td><input readonly type="text" name="inputM5" value="<?php echo $m5; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M6</td>
                    <td><input readonly type="text" name="inputM6" value="<?php echo $m6; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_DIMENSION; ?> M7</td>
                    <td><input readonly type="text" name="inputM7" value="<?php echo $m7; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?></td>
                    <td><input readonly type="text" name="area" value="<?php echo $_POST['area']; ?> m2" /></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_GENERALITIES; ?> - <?php echo TXT_SUBMENU_HEATING; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_INSIDE_TEMP; ?></td>
                    <td><input readonly type="text" name="temperatureIndoor" value="<?php echo $_POST['temperatureIndoor']; ?> °C" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_SITUATION_BUILDING; ?> </td>
                    <td><input readonly type="text" name="situation" value="<?php echo $_POST['selectGeneralitiesHeating']; ?>" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td><?php $orientation = $_POST['selectAdjoiningOrientation']; ?>
                        <input hidden type="text" name="orientation" value="<?php echo $orientation; ?>" /><?php
                        if ($orientation == 'MurNord') {
                            echo TXT_NORD_WALL;
                        }
                        if ($orientation == 'MurEst') {
                            echo TXT_EAST_WALL;
                        }
                        if ($orientation == 'MurSud') {
                            echo TXT_SOUTH_WALL;
                        }
                        if ($orientation == 'MurOuest') {
                            echo TXT_WEST_WALL;
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_HEATED_ROOMS; ?></td>
                    <td><?php $heating = $_POST['heating']; ?>
                        <input hidden type="text" name="heating" value="<?php echo $heating; ?>" /><?php
                        if ($heating == 'ccc') {
                            echo 'Tout chauffé';
                        }
                        if ($heating == 'ccn') {
                            echo 'Tout chauffé sauf le sous-sol';
                        }
                        if ($heating == 'ncc') {
                            echo 'Tout chauffé sauf le dernier étage';
                        }
                        if ($heating == 'ncn') {
                            echo 'Le dernier étage et le sous-sol sont non chauffés';
                        }
                        if ($heating == 'cc') {
                            echo 'Tout chauffé, sans sous-sol';
                        }
                        if ($heating == 'nc') {
                            echo 'Le dernier étage est non chauffé, sans sous-sol';
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="lign"></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_WALLS; ?>"</th>
                </tr>
                <tr>
                    <td>Année de rénovation des murs</td>
                    <td><input readonly type="text" name="yearChangedWall" value="<?php echo $_POST['yearChangedWall']; ?>" /></td>
                </tr>
                <tr>
                    <td>Orientation du Mur A</td>
                    <td><input readonly type="text" name="selectOrientation" value="<?php echo $_POST['selectOrientation']; ?>" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_WALL ?> A</td>
                    <td><input readonly type="text" name="areaWallA" value="<?php echo $_POST['areaWallA']; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_WALL ?> B</td>
                    <td><input readonly type="text" name="areaWallB" value="<?php echo $_POST['areaWallB']; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_WALL ?> C</td>
                    <td><input readonly type="text" name="areaWallC" value="<?php echo $_POST['areaWallC']; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_WALL ?> D</td>
                    <td><input readonly type="text" name="areaWallD" value="<?php echo $_POST['areaWallD']; ?> m2" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_WALL ?> E</td>
                    <td><input readonly type="text" name="areaWallE" value="<?php echo $_POST['areaWallE']; ?> m2" /></td>
                </tr>
                <tr>
                    <td colspan="2" class="lign"></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_ROOF; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?></td>
                    <td><input readonly type="text" name="areaRoof" value="<?php echo $_POST['roofArea']; ?> m2" /></td>
                </tr>
                <tr>
                    <td>Année de rénovation du toit</td>
                    <td><input readonly type="text" name="yearChangedRoof" value="<?php echo $_POST['yearChangedRoof']; ?>" /></td>
                </tr>
                <tr>
                    <td colspan="2" class="lign"></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs des pages "<?php echo TXT_TAB_FLOOR_CEILING; ?>"</th>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_SUBMENU_FLOOR; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?></td>
                    <td><input readonly type="text" name="areaFloor" value="<?php echo $_POST['floorArea']; ?> m2" /></td>
                </tr>
                <tr>
                    <td>Année de rénovation du sol</td>
                    <td><input readonly type="text" name="yearChangedFloor" value="<?php echo $_POST['yearChangedFloor']; ?>" /></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_SUBMENU_CEILING; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?></td>
                    <td><input readonly type="text" name="areaCeiling" value="<?php echo $_POST['ceilingArea']; ?> m2" /></td>
                </tr>
                <tr>
                    <td>Année de rénovation du plafond</td>
                    <td><input readonly type="text" name="yearChangedCeiling" value="<?php echo $_POST['yearChangedCeiling']; ?>" /></td>
                </tr>
                <tr>
                    <td colspan="2" class="lign"></td>
                </tr>
                <tr>
                    <th colspan="2">Valeurs des pages "<?php echo TXT_TAB_WINDOWS; ?>"</th>
                </tr>
                <tr>
                    <td><?php echo TXT_TYPE_WINDOW; ?></td>
                    <td><?php $windowType = $_POST['windowType']; ?>
                        <input hidden type="text" name="windowType" value="<?php echo $windowType; ?>" /><?php
                            if ($windowType == 1) {
                                echo TXT_ONE_LEAF;
                            }
                            if ($windowType == 2) {
                                echo TXT_TWO_LEAVES;
                            }
                            if ($windowType == 3) {
                                echo TXT_THREE_LEAVES;
                            }
                            if ($windowType == 4) {
                                echo TXT_FOUR_LEAVES;
                            }
                            if ($windowType == 5) {
                                echo TXT_TWO_LEAVES_FOUR_GLASSES;
                            }
                            if ($windowType == 6) {
                                echo TXT_TWO_LEAVES_THREE_GLASSES;
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td>Année de changement des fenêtres</td>
                    <td><input readonly type="text" name="yearChangedWindow" value="<?php echo $_POST['yearChangedWindow']; ?>" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_NUMBER_ROOF_LIGHT; ?></td>
                    <td><input readonly type="text" name="roofLightNumber" value="<?php echo $_POST['roofLightNumber']; ?>" /></td>
                </tr>
                <tr>
                    <td><?php echo TXT_BLINDS; ?></td>
                    <td><?php $blinds = $_POST['blinds']; ?>
                        <input hidden type="text" name="blinds" value="<?php echo $blinds; ?>" /><?php
                            if ($blinds == 'true') {
                                echo TXT_YES;
                            }
                            if ($blinds == 'false') {
                                echo TXT_NO;
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?> - <?php echo TXT_NORTH; ?></td>
                    <td>
                        <ul>
                            <li><input readonly type="text" name="areaWindowNorth" value="<?php echo $_POST['areaWindowNorth']; ?> %" /></li>
                            <li><input readonly type="text" name="measureWindowNorth" value="<?php echo $_POST['measureWindowNorth']; ?> m2" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?> - <?php echo TXT_EAST; ?></td>
                    <td>
                        <ul>
                            <li><input readonly type="text" name="areaWindowEast" value="<?php echo $_POST['areaWindowEast']; ?> %" /></li>
                            <li><input readonly type="text" name="measureWindowEast" value="<?php echo $_POST['measureWindowEast']; ?> m2" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?> - <?php echo TXT_SOUTH; ?></td>
                    <td>
                        <ul>
                            <li><input readonly type="text" name="areaWindowSouth" value="<?php echo $_POST['areaWindowSouth']; ?> %" /></li>
                            <li><input readonly type="text" name="measureWindowSouth" value="<?php echo $_POST['measureWindowSouth']; ?> m2" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td><?php echo TXT_AREA; ?> - <?php echo TXT_WEST; ?></td>
                    <td>
                        <ul>
                            <li><input readonly type="text" name="areaWindowWest" value="<?php echo $_POST['areaWindowWest']; ?> %" /></li>
                            <li><input readonly type="text" name="measureWindowWest" value="<?php echo $_POST['measureWindowWest']; ?> m2" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="lign"></td>
                </tr>
                <!-- A FINIR QUAND GASP AURA FINI LA PAGE.. -->
                <tr>
                    <th colspan="2">Valeurs de la page "<?php echo TXT_TAB_FACILITIES; ?>"</th>
                </tr>
                <tr>
                    <td>Type d'installation pour le <?php echo TXT_HEATING; ?></td>
                    <td><input readonly type="text" name="selectHeating" value="<?php echo $_POST['selectHeating']; ?>" /></td>
                </tr>
                <tr>
                    <td>Année de remplacement de l'installation</td>
                    <td><input readonly type="text" name="yearChangedHeating" value="<?php echo $_POST['yearChangedHeating']; ?>" /></td>
                </tr>
                <tr>
                    <td>Consommation</td>
                    <td>
                        <ul>
                            <li>
                                <input readonly type="text" name="consommationChauffage" value="<?php echo $_POST['consommationChauffageLitre']; ?>" />
                                <input readonly type="text" name="uniteChauffage" value="<?php echo $_POST['uniteChauffage'] ?>" />
                            </li>
                            <li><input readonly type="text" name="consommationChauffageCHF" value="<?php echo $_POST['consommationChauffageCHF']; ?> CHF" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>Type d'installation pour le <?php echo TXT_HOTWATER; ?></td>
                    <td><input readonly type="text" name="selectHotWater" value="<?php echo $_POST['selectHotWaterHidden']; ?>" /></td>
                </tr>
                <tr>
                    <td>Année de remplacement de l'installation</td>
                    <td><input readonly type="text" name="yearChangedHotWater" value="<?php echo $_POST['yearChangedHotWater']; ?>" /></td>
                </tr>
                <tr>
                    <td>Consommation</td>
                    <td>
                        <ul>
                            <li>
                                <input readonly type="text" name="consommationEauChaude" value="<?php echo $_POST['consommationEauChaudeLitre']; ?>" />
                                <input readonly type="text" name="uniteEauChaude" value="<?php echo $_POST['uniteChauffage'] ?>" />
                            </li>
                            <li><input readonly type="text" name="consommationEauChaudeCHF" value="<?php echo $_POST['consommationEauChaudeCHF']; ?> CHF" /></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td><button class="large button green" type="submit">Valider</button></td>
                    <td><a class="large button green" onclick="window.close()" >Modifier</a></td>
                </tr>
            </table>
        </form>
    </body>
</html>